OPC Studio User's Guide and Reference
Do not write any code for OPC failure recovery
Concepts > QuickOPC Concepts > QuickOPC Best Practices > Do not write any code for OPC failure recovery

As described in Failure Recovery, problems in communications with target OPC server are automatically recognized, and the component performs the recovery automatically. Attempts to duplicate this functionality in your code will interfere with this mechanism and won’t work.

It is fine (and indeed, suggested) to catch the errors and handle them appropriately. But the error handling should not include attempts to remedy the situation. If you are doing "one-shot" operations (such as reads, writes etc.), it is OK to re-try them later. If you are subscribing, you should not attempt to un-subscribe in case of a problem. The component does this by itself. Making a subscription in QuickOPC means an intent to subscribe and stay subscribed whenever possible, until you explicitly unsubscribe, and the component works in the background to fulfill this. This is valid even if the very first (initial) subscription attempt fails; the component will keep re-trying internally, unless you unsubscribe.

In QuickOPC-UA, you can call a static method EasyUAClient.CloseAll to close all unused sessions that are open to OPC-UA servers.

See Also